﻿using System;
using System.Linq;
using System.Collections.Generic;

namespace HashFoo.Rest.Common
{
    /// <summary>
    /// Filter desciptor -- meta data to filter results on the server side.
    /// </summary>
    public class Filter
    {
        /// <summary>
        /// The property to filter on.
        /// </summary>
        public string PropertyName { get; set; }

        /// <summary>
        /// The type of <see cref="FilterOp"/> comparison for the <see cref="PropertyName"/> and <see cref="Value"/>
        /// </summary>
        public FilterOp Op { get; set; }

        /// <summary>
        /// The value to filter the <see cref="PropertyName"/> against.
        /// </summary>
        public object Value { get; set; }
    }

    /// <summary>
    /// Filter operations
    /// </summary>
    public enum FilterOp
    {
        /// <summary>
        /// Equals
        /// </summary>
        Eq,

        /// <summary>
        /// Greater Than
        /// </summary>
        Gt,

        /// <summary>
        /// Greather Than or Equal To
        /// </summary>
        Gte,

        /// <summary>
        /// Less Than
        /// </summary>
        Lt,

        /// <summary>
        /// Less Than or Equal To
        /// </summary>
        Lte,

        /// <summary>
        /// Not Equal
        /// </summary>
        Neq
    }
}